package org.easymis.crm.modules.biplatform.entitys.mybatis.mapper;

import java.util.HashMap;
import java.util.List;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Many;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.easymis.crm.modules.biplatform.entitys.mybatis.dto.Card;
import org.easymis.crm.modules.biplatform.entitys.mybatis.dto.Dashboard;

public interface DashboardMapper {
	@Select("SELECT * FROM bi_dashboard")
	@Results({ @Result(property = "dashboardId", column = "dashboard_id"),
			@Result(property = "dashboardTitle", column = "dashboard_title"),
			@Result(property = "cardList", column = "dashboard_id", many = @Many(select = "xsscd.monitor.air.southwest.modules.biplatform.entitys.mybatis.mapper.CardMapper.findByDashboardId")) })
	public List<Dashboard> getList(HashMap<String, Object> params);
	@Insert("INSERT INTO bi_dashboard(dashboard_id,dashboard_title)values(#{dashboardId},#{dashboardTitle})")
	public void save(Dashboard bean);

	public void saveBatch(List<Dashboard> beans);

	public void update(Dashboard bean);

	public void delete(String DashboardId);

	public void removeBatch(List<String> list);

	public void restoreBatch(List<String> list);

	public void deleteBatch(List<String> list);

	@Select("SELECT * FROM bi_dashboard where dashboard_id=#{#{orgId} ")
	@Results({ @Result(property = "dashboardId", column = "dashboard_id"),
			@Result(property = "dashboardTitle", column = "dashboard_title"),
			@Result(property = "positionJson", column = "position_json"),			
			@Result(property = "cardList", column = "dashboard_id", many = @Many(select = "xsscd.monitor.air.southwest.modules.biplatform.entitys.mybatis.mapper.CardMapper.findByDashboardId")) })
	public Dashboard findById(String dashboardId);

	public List<Card> findByIds(List<String> list);
}
